package com.zjj.filmcommentapi.utils;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.zjj.filmcommentapi.model.User;

import java.util.Date;

/**
 * 生成token
 */
public class  JwtToken {
    public static  String createToken(User user){
        String token = "";
//        token = JWT.create().withAudience(user.getAccount()).sign(Algorithm.HMAC256(user.getPassword()));
        token = JWT.create().withAudience(user.getAccount()).withClaim("date",System.currentTimeMillis()).sign(Algorithm.HMAC256(user.getPassword()));
        return  token;
    }
}
